{{include './components/head.html' '首页'}}

<body>
    <!-- 在views文件夹放置的都是模板 -->
    <nav class="navbar navbar-default" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="/">博客系统</a>
            </div>
            <ul class="nav navbar-nav navbar-right">
                {{if username}}
                <li><a href="/user"><span class="glyphicon glyphicon-user"></span>{{username}}</a></li>
                <li><a href="/layout"><span class="glyphicon glyphicon-log-in"></span>退出</a></li>
                {{else}}
                <li><a href="/register"><span class="glyphicon glyphicon-user"></span> 注册</a></li>
                <li><a href="/login"><span class="glyphicon glyphicon-log-in"></span> 登录</a></li>
                {{/if}}

            </ul>
        </div>
    </nav>
    {{if username}}
    <div class="container">
        <div class="well well-lg">
            {{ error ? msg : "你好" }}
        </div>
        {{each postList item index}}
        <div class="media">
            <div class="media-body">
                <a href="/post?postId={{item.id}}"><h4 class="media-heading">{{item.title}}</h4></a>
               
                <p>{{item.post}}</p>
                <div>{{item.username}} | {{item.publishTime}}</div>
            </div>
        </div>
        {{/each}}

        {{else}}
        <div class="container">
            <div class="well well-lg">请注册登录！</div>
        </div>
        {{/if}}

</body>

</html>